using System;
using System.Collections.Generic;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
using Common;
using Common.Enum;

namespace SWellPlate
{
	public class ProjectTypeToSampleTypeConverter : IValueConverter
	{
		public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
		{
			if (value != null && value != DependencyProperty.UnsetValue && value is EProjectType)
			{
				EProjectType eProjectType = (EProjectType)value;
				if (eProjectType == EProjectType.HRM || eProjectType == EProjectType.AD)
				{
					List<KeyValuePair> list = new List<KeyValuePair>();
					list.Add(new KeyValuePair
					{
						Key = SampleType.Unknown,
						Value = EnumManagement.GetSampleTypeName(SampleType.Unknown)
					});
					list.Add(new KeyValuePair
					{
						Key = SampleType.Standard,
						Value = EnumManagement.GetSampleTypeName(SampleType.Standard)
					});
					list.Add(new KeyValuePair
					{
						Key = SampleType.Negative,
						Value = EnumManagement.GetSampleTypeName(SampleType.Negative)
					});
					list.Add(new KeyValuePair
					{
						Key = SampleType.NTC,
						Value = EnumManagement.GetSampleTypeName(SampleType.NTC)
					});
					return list;
				}
			}
			return EnumManagement.GetAllSampleType();
		}

		public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
		{
			return value;
		}
	}
}
